package PTA_JAVA.JavaB.Javademo16;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        ArrayList<Person> person= new ArrayList<Person>();
        for (int i = 0; i < n; i++) {
            Person p= new Person(sc.next(),Integer.parseInt(sc.next()));
            int f=0;
            for(Person j:person){
                if(j.equals(p)){
                    f=1;
                    break;
                }
            }
            if(f==0){
                person.add(p);
            }
        }
        System.out.println(person.toString());
    }
}
class Person{
    private String name;
    private int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        Person person = (Person) o;
        return age == person.age && Objects.equals(name.toLowerCase(), person.name.toLowerCase());
    }

    @Override
    public String toString() {
        return "Person [" +
                "name=" + name +
                ", age=" + age +
                ']';
    }
}
